﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords"
          content="candidates, career, employment, freelance, glassdoor, Human Resource Management, indeed, job board, job listing, job portal, job postings, jobs, listings, recruitment, resume">
    <meta name="CreativeLayers" content="ATFN">
    <!-- css file -->
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/menu.css">
    <link rel="stylesheet" href="/css/style.css">
    <link rel="stylesheet" type="text/css" href="/css/verify.css">
    <!-- Responsive stylesheet -->
    <link rel="stylesheet" href="/css/responsive.css">
    <!-- Title -->
    <title>未来是你的 - The Future Is Yours 一个能让你找到满意的工作的网站</title>
    <!-- Favicon -->
    <link href="/images/favicon.ico" sizes="128x128" rel="shortcut icon" type="image/x-icon"/>
    <link href="/images/favicon.ico" sizes="128x128" rel="shortcut icon"/>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <script type="text/javascript" src="/js/jquery-3.2.1.js"/>
    <![endif]-->
    <script th:inline="javascript">
        var email = [[${session.company.email}]];
        var company_id = [[${session.company.company_id}]];
    </script>
    <script type="text/javascript">
        window.onload = function () {
            // console.log(email);
            console.log(company_id);
            $.post("/delivery/getDeliveryCount", {"company_id": company_id}, function (count) {
                $("#deliveryCount").text(count);
            })
        }

        function saveCompanyInfo() {
            let form_data = $("#companyInfo_form").serialize();
            console.log(form_data);
            $.post("/company/saveCompanyInfo", form_data + "&info_id=" + company_id, function (message) {
                console.log(message);
                alert(message);
                setTimeout("window.location.href='/company/toCompanyProfile'",1500);
            });
        }

        function changePassword() {
            var oldPassword = $("#oldPassword").val();
            var newPassword = $("#newPassword").val();
            var confirmPassword = $("#confirmPassword").val();
            console.log(oldPassword);
            console.log(newPassword);
            console.log(confirmPassword);
            if (newPassword == confirmPassword && newPassword != '' && oldPassword != newPassword) {
                $.post("/user/changePassword", {
                    "email": email,
                    "oldPassword": oldPassword,
                    "newPassword": newPassword,
                    "confirmPassword": confirmPassword
                }, function (data) {
                    if (data == '旧密码输入有误') {
                        alert(data);
                    } else {
                        alert(data);
                        setTimeout("window.location.href='/user/toLoginPage'", 2000);
                    }
                })
            } else if (newPassword == '') {
                alert("新密码不能为空");
            } else if (newPassword == oldPassword) {
                alert("新密码和旧密码一致，请重新输入");
            } else {
                alert("新密码和确认密码不一致");
            }

        }

        function validateUsername(e) {
            if ($(e).val() == "") {
                alert("用户名不能为空");
                $(e).css("border-color", "red");
            } else {
                $(e).css("border-color", "#ced4da");
            }
        }

        function validateEmail(e) {
            //Email正则
            var ePattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
            if (!ePattern.test($(e).val())) {
                alert("请输入正确的邮箱格式");
                $(e).css("border-color", "red");
                $(e).val("");
            } else {
                $(e).css("border-color", "#ced4da");
            }
        }

        function validatePhone(e) {
            //手机号正则
            var mPattern = /^1[3456789]\d{9}$/;
            if (!mPattern.test($(e).val())) {
                alert("请输入正确的手机号码");
                $(e).css("border-color", "red");
                $(e).val("");
                return false;
            } else {
                $(e).css("border-color", "#ced4da");
                return true;
            }
        }

        function validatePassword(e) {
            //只能输入6-20个字母、数字、下划线
            var pPattern = /^(\w){6,18}$/;
            if (!pPattern.test($(e).val())) {
                alert("请输入输入6-18个字母、数字、下划线");
                $(e).css("border-color", "red");
                $(e).val("");
            } else {
                $(e).css("border-color", "#ced4da");
            }
        }

        // #register-form
        function registerUser() {
            console.log($("#exampleCheck2").prop("checked"));
            if ($("#exampleCheck2").prop("checked") == true) {
                $.post("/user/register", $("#register-form").serialize(), function (data) {
                    // console.log(data);
                    if (data == '注册成功') {
                        alert(data);
                        setTimeout("window.location.href='/user/toLoginPage'", 2000);
                    } else {
                        alert(data);
                    }
                })
            } else {
                alert("请确认您接受条款和条件及隐私政策");
            }

        }
    </script>
</head>
<body>

<div class="wrapper">
    <div class="preloader"></div>

    <!-- Main Header Nav -->
    <header class="header-nav menu_style_home_one navbar-scrolltofixed stricky main-menu" style="background: black;">
        <div class="container">
            <!-- Ace Responsive Menu -->
            <nav>
                <!-- Menu Toggle btn-->
                <div class="menu-toggle">
                    <img class="nav_logo_img img-fluid" src="/images/header-logo.png" alt="header-logo.png">
                    <button type="button" id="menu-btn">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>
                <a href="/company/toCompanyProfile" class="navbar_brand float-left dn-smd">
                    <img class="img-fluid" src="/images/header-logo.png" alt="header-logo.png">
                </a>
                <!-- Responsive Menu Structure-->
                <!--Note: declare the Menu style in the data-menu-style="horizontal" (options: horizontal, vertical, accordion) -->
                <ul id="respMenu" class="ace-responsive-menu" data-menu-style="horizontal">
                    <li>
                        <a href="/company/toCompanyProfile"><span class="title">首页</span></a>
                    </li>
                    <li>
                        <a href="/position/searchPosition"><span class="title">职位</span></a>
                    </li>
                    <li class="last">
                        <a th:if="${session.user==null}" href="/user/toLoginPage"><span class="title">我要找工作</span></a>
                    </li>
                    <li class="last">
                        <a th:if="${session.company==null}" href="/company/toLoginPage"><span class="title">我要招聘</span></a>
                    </li>
                </ul>
                <ul class="sign_up_btn pull-right dn-smd mt10" th:if="${session.company==null}">
                    <li><a href="#" class="btn btn-md" data-toggle="modal" data-target="#exampleModalCenter"
                           style="font-family: 宋体">登<span class="dn-md">录</span>/注<span class="dn-md">册</span></a></li>
                </ul><!-- Button trigger modal -->
                <!--                登录成功之后的个人栏目-->
                <ul class="header_user_notif pull-right dn-smd" th:if="${session.company!=null}">
                    <li class="user_notif">
                    </li>
                    <li class="user_setting">
                        <div class="dropdown">
                            <a class="btn dropdown-toggle" href="#" data-toggle="dropdown"><img class="rounded-circle"
                                                                                                src="/images/team/e1.png"
                                                                                                alt="e1.png"> <span
                                    class="pl15 pr15" th:text="${session.company}!=null?${session.company.name}:''"></span></a>
                            <div class="dropdown-menu">
                                <div class="user_set_header">
                                    <p th:text="'你好,   '+${session.company.name}"></p>
                                </div>
                                <div class="user_setting_content">
                                    <a class="dropdown-item" href="/company/toCompanyProfile"><span
                                            class="flaticon-profile"></span> 公司信息</a>
                                    <a class="dropdown-item" href="/company/toApplyManage"><span
                                            class="flaticon-paper-plane"></span> 管理申请</a>
                                    <a class="dropdown-item" href="/company/toPostJob"><span
                                            class="flaticon-analysis"></span> 发布工作</a>
                                    <a class="dropdown-item" href="/company/toPostedJob"><span
                                            class="flaticon-favorites"></span> 已发布工作</a>
                                    <a class="dropdown-item" href="/company/toChangePassword"><span
                                            class="flaticon-locked"></span> 修改密码</a>
                                    <a class="dropdown-item" href="/company/logout"><span
                                            class="flaticon-logout"></span>
                                        退出登录</a>
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </nav>
        </div>
    </header>
    <!-- Modal -->
    <div class="sign_up_modal modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                </div>
                <ul class="sign_up_tab nav nav-tabs" id="myTab" role="tablist">
                    <li class="nav-item">
                        <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab"
                           aria-controls="home" aria-selected="true">登录</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab"
                           aria-controls="profile" aria-selected="false">注册</a>
                    </li>
                </ul>
                <div class="tab-content" id="myTabContent">
                    <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
                        <div class="login_form">
                            <div class="heading">
                                <h3 class="text-center">快速登录</h3>

                            </div>
                            <div>
                                <ul class="nav nav-pills mb-4" id="pills-tab" role="tablist">
                                    <li class="nav-item">
                                        <a class="nav-link active" id="pills-home-tab" data-toggle="pill"
                                           href="#pills-home" role="tab" aria-controls="pills-home"
                                           aria-selected="true"
                                           style="border: 1px solid #79b530;width: 200px;text-align: center;">个人账户</a>
                                    </li>
                                    <li class="nav-item">
                                        <a class="nav-link" id="pills-profile-tab" data-toggle="pill"
                                           href="#pills-profile" role="tab" aria-controls="pills-profile"
                                           aria-selected="false"
                                           style="border: 1px solid #79b530;width: 200px;text-align: center;margin-left: 17px;">企业账户</a>
                                    </li>
                                </ul>
                            </div>

                            <div class="tab-content" id="pills-tabContent">
                                <div class="tab-pane fade show active" id="pills-home" role="tabpanel"
                                     aria-labelledby="pills-home-tab">
                                    <form id="login-form1">
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="exampleInputEmail1" name="email"
                                                   placeholder="电子邮箱" onblur="validateEmail(this)">
                                            <!--                                            <span>邮箱有问题</span>-->
                                        </div>
                                        <div class="form-group">
                                            <input type="password" class="form-control" id="exampleInputPassword1"
                                                   name="password"
                                                   placeholder="密码">
                                        </div>
                                        <!--验证码-->
                                        <div class="mpanel3" style="margin-top: 20px">
                                        </div>
                                        <div class="form-group form-check">

                                        </div>
                                        <button type="button" class="btn btn-log btn-block btn-thm" id="check-btn2">登录
                                        </button>
                                        <hr>
                                        <div class="row mt40">
                                            <div class="col-lg">
                                            </div>
                                            <div class="col-lg">
                                            </div>
                                        </div>
                                    </form>
                                </div>
                                <div class="tab-pane fade" id="pills-profile" role="tabpanel"
                                     aria-labelledby="pills-profile-tab">
                                    <form action="#">
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="exampleInputEmail11"
                                                   placeholder="电子邮箱">
                                        </div>
                                        <div class="form-group">
                                            <input type="password" class="form-control" id="exampleInputPassword11"
                                                   placeholder="密码">
                                        </div>
                                        <!--验证码-->
                                        <div class="mpanel33" style="margin-top: 20px">
                                        </div>
                                        <div class="form-group form-check">
                                            <input type="checkbox" class="form-check-input" id="exampleCheck11">
                                            <label class="form-check-label" for="exampleCheck11">记住密码</label>
                                            <a class="tdu text-thm float-right" href="#">忘记密码?</a>
                                        </div>
                                        <button type="submit" class="btn btn-log btn-block btn-thm" id="check-btn22">
                                            登录
                                        </button>
                                        <hr>
                                        <div class="row mt40">
                                            <div class="col-lg">
                                            </div>
                                            <div class="col-lg">
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
                        <div class="sign_up_form">
                            <div class="heading">
                                <h3 class="text-center">创建个人账户</h3>
                            </div>
                            <form id="register-form">
                                <div class="form-group">
                                    <input type="text" class="form-control" id="exampleInputName1" placeholder="用户名"
                                           name="username" onblur="validateUsername(this)" required="required">
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" id="exampleInputEmail2" placeholder="电子邮箱"
                                           name="email" onblur="validateEmail(this)" required="required">
                                </div>
                                <div class="form-group">
                                    <input type="text" class="form-control" id="exampleInputPhone1"
                                           placeholder="电话号码" name="phone" onblur="validatePhone(this)"
                                           required="required">
                                </div>
                                <div class="form-group">
                                    <label style="float:left;"></label>
                                    <input type="text" class="form-control" placeholder="6位数字验证码"
                                           style="width: 230px;float: left;" name="messageCode" required="required">
                                    <span class="msgs">获取短信验证码</span>
                                </div>
                                <div class="form-group">
                                    <input type="password" class="form-control" id="exampleInputPassword2"
                                           placeholder="密码" name="password" onblur="validatePassword(this)"
                                           required="required">
                                </div>
                                <div class="form-group form-check">
                                    <input type="checkbox" class="form-check-input" id="exampleCheck2"
                                           required="required">
                                    <label class="form-check-label" for="exampleCheck2">请确认您接受条款和条件及隐私政策 </label>
                                </div>
                                <button type="button" class="btn btn-log btn-block btn-dark" id="register-btn"
                                        onclick="registerUser()">注册
                                </button>
                                <hr>
                                <div class="row mt40">
                                    <div class="col-lg">
                                    </div>
                                    <div class="col-lg">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <!-- Our Dashbord -->
    <section class="our-dashbord dashbord">
        <div class="container">
            <div class="row">
                <div class="col-sm-12 col-lg-4 col-xl-3 dn-smd">
                    <div class="user_profile">
                        <div class="media">
                            <img src="/images/team/e1.png" class="align-self-start mr-3 rounded-circle" alt="e1.png">
                            <div class="media-body">
                                <h5 class="mt-0" th:text="'你好,   '+${session.company.name}">Hi, Martha Griffin</h5>
                            </div>
                        </div>
                    </div>
                    <div class="dashbord_nav_list">
                        <ul>
                            <li class="active"><a href="/company/toCompanyProfile"><span class="flaticon-profile"></span> 公司信息</a>
                            </li>
                            <li><a href="/company/toPostJob"><span class="flaticon-resume"></span> 发布工作</a></li>
                            <li><a href="/company/toPostedJob"><span class="flaticon-favorites"></span> 已发布工作</a>
                            </li>
                            <li><a href="/company/toApplyManage"><span class="flaticon-paper-plane"></span> 管理申请</a></li>
                            <li><a href="/company/toChangePassword"><span class="flaticon-locked"></span> 修改密码</a></li>
                            <li><a href="/company/logout"><span class="flaticon-logout"></span> 退出登录</a></li>
                        </ul>
                    </div>

                </div>
                <div class="col-sm-12 col-lg-8 col-xl-9">
                    <div class="my_profile_form_area employer_profile">
                        <div class="row">
                            <div class="col-lg-12">
                                <h4 class="fz20 mb20">公司信息</h4>
                            </div>
                            <form class="row" method="post" enctype="multipart/form-data" id="companyInfo_form">
                                <div class="col-md-6 col-lg-6">
                                    <div class="my_profile_input form-group">
                                        <label>公司名称</label>
                                        <input type="text" class="form-control" id="company_name" name="company_name" th:value="${companyInfo}!=null?${companyInfo.company_name}:''">
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-6">
                                    <div class="my_profile_input form-group">
                                        <label>所在省份</label>
                                        <input type="text" class="form-control" id="province" name="province" th:value="${companyInfo}!=null?${companyInfo.province}:''">
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-6">
                                    <div class="my_profile_input form-group">
                                        <label>所在城市</label>
                                        <input type="text" class="form-control" id="city" name="city" th:value="${companyInfo}!=null?${companyInfo.city}:''">
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-6">
                                    <div class="my_profile_input form-group">
                                        <label>所在行业</label>
                                        <input type="text" class="form-control" id="industry" name="industry" th:value="${companyInfo}!=null?${companyInfo.industry}:''">
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-6">
                                    <div class="my_profile_input form-group">
                                        <label>联系人</label>
                                        <input type="text" class="form-control" id="contact" name="contact" th:value="${companyInfo}!=null?${companyInfo.contact}:''">
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-6">
                                    <div class="my_profile_select_box form-group">
                                        <label>性别</label><br>
                                        <select class="selectpicker" id="sex" name="sex">
                                            <option value="男" th:selected="${resume!=null&&resume.sex=='男'}" selected="selected">男</option>
                                            <option value="女" th:selected="${resume!=null&&resume.sex=='女'}">女</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-6">
                                    <div class="my_profile_input form-group">
                                        <label>电话</label>
                                        <input type="text" class="form-control" id="phone" name="phone" th:value="${companyInfo}!=null?${companyInfo.phone}:''">
                                    </div>
                                </div>
                                <div class="col-lg-12">
                                    <h4 class="fz18 mb20">公司简介</h4>
                                </div>
                                <div class="col-lg-12">
                                    <div class="my_resume_textarea mt20">
                                        <div class="form-group">
                                            <textarea class="form-control" id="company_introduction" name="company_introduction" rows="9" th:text="${companyInfo}!=null?${companyInfo.company_introduction}:''">
									        </textarea>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-4">
                                    <div class="my_profile_input">
                                        <a class="btn btn-lg btn-thm" href="javascript:;" onclick="saveCompanyInfo()">保存修改</a>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <a class="scrollToHome text-thm" href="#"><i class="flaticon-rocket-launch"></i></a>
</div>
<!-- Wrapper End -->
<script type="text/javascript" src="/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="/js/jquery-migrate-3.0.0.min.js"></script>
<script type="text/javascript" src="/js/popper.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/jquery.mmenu.all.js"></script>
<script type="text/javascript" src="/js/ace-responsive-menu.js"></script>
<script type="text/javascript" src="/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/js/snackbar.min.js"></script>
<script type="text/javascript" src="/js/simplebar.js"></script>
<script type="text/javascript" src="/js/parallax.js"></script>
<script type="text/javascript" src="/js/scrollto.js"></script>
<script type="text/javascript" src="/js/jquery-scrolltofixed-min.js"></script>
<script type="text/javascript" src="/js/jquery.counterup.js"></script>
<script type="text/javascript" src="/js/wow.min.js"></script>
<script type="text/javascript" src="/js/progressbar.js"></script>
<script type="text/javascript" src="/js/slider.js"></script>
<script type="text/javascript" src="/js/timepicker.js"></script>
<!-- Custom script for all pages -->
<script type="text/javascript" src="/js/script.js"></script>
<!--验证码-->
<script type="text/javascript" src="/js/verify.js"></script>
<script type="text/javascript">
    $('.mpanel3').codeVerify({
        type: 2,
        figure: 100,	//位数，仅在type=2时生效
        arith: 0,	//算法，支持加减乘，不填为随机，仅在type=2时生效
        width: '200px',
        height: '50px',
        fontSize: '30px',
        btnId: 'check-btn2',
        ready: function () {
        },
        success: function () {
            // alert("验证码正确");
            $.post("/user/login", $("#login-form1").serialize(), function (data) {
                console.log(data);
                console.log($("#message").text());
                if (data == 'true') {
                    window.location.href = "/user/index";
                } else {
                    alert("登录失败，邮箱或密码错误");
                }
            })
        },
        error: function () {
            alert('验证码不正确！');
        }
    });
    $('.mpanel33').codeVerify({
        type: 2,
        figure: 100,	//位数，仅在type=2时生效
        arith: 0,	//算法，支持加减乘，不填为随机，仅在type=2时生效
        width: '200px',
        height: '50px',
        fontSize: '30px',
        btnId: 'check-btn22',
        ready: function () {
        },
        success: function () {
            alert('验证匹配！');
        },
        error: function () {
            alert('验证码不匹配！');
        }
    });
</script>
</body>
</html>